// Decompiled on 周六 2月 22 19:31:49 CST 2025 with Zomboid Decompiler v0.1.3 using Vineflower.
package zombie.audio.parameters;

import zombie.audio.FMODLocalParameter;
import zombie.characters.IsoGameCharacter;
import zombie.core.skinnedmodel.visual.ItemVisual;
import zombie.core.skinnedmodel.visual.ItemVisuals;
import zombie.scripting.objects.Item;

public final class ParameterShoeType extends FMODLocalParameter {
    private static final ItemVisuals tempItemVisuals = new ItemVisuals();
    private final IsoGameCharacter character;
    private ParameterShoeType.ShoeType shoeType = null;

    public ParameterShoeType(IsoGameCharacter _character) {
        super("ShoeType");
        this.character = _character;
    }

    @Override
    public float calculateCurrentValue() {
        if (this.shoeType == null) {
            this.shoeType = this.getShoeType();
        }

        return (float)this.shoeType.label;
    }

    private ParameterShoeType.ShoeType getShoeType() {
        this.character.getItemVisuals(tempItemVisuals);
        Item item0 = null;

        for (int _int = 0; _int < tempItemVisuals.size(); _int++) {
            ItemVisual itemVisual = (ItemVisual)tempItemVisuals.get(_int);
            Item item1 = itemVisual.getScriptItem();
            if (item1 != null && "Shoes".equals(item1.getBodyLocation())) {
                item0 = item1;
                break;
            }
        }

        if (item0 == null) {
            return ParameterShoeType.ShoeType.Barefoot;
        } else {
            String string = item0.getName();
            if (string.contains("Boots") || string.contains("Wellies")) {
                return ParameterShoeType.ShoeType.Boots;
            } else if (string.contains("FlipFlop")) {
                return ParameterShoeType.ShoeType.FlipFlops;
            } else if (string.contains("Slippers")) {
                return ParameterShoeType.ShoeType.Slippers;
            } else {
                return string.contains("Trainer") ? ParameterShoeType.ShoeType.Sneakers : ParameterShoeType.ShoeType.Shoes;
            }
        }
    }

    public void setShoeType(ParameterShoeType.ShoeType shoeTypex) {
        this.shoeType = shoeTypex;
    }

    private static enum ShoeType {
        Barefoot(0),
        Boots(1),
        FlipFlops(2),
        Shoes(3),
        Slippers(4),
        Sneakers(5);

        final int label;

        private ShoeType(int int1) {
            this.label = int1;
        }
    }
}
